package com.me.screen;

import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.me.constant.Constant;
import com.me.control.CreateWindown;
import com.me.enums.ScreenEnum;
import com.me.myAppleDrop.MainAppleActive;

public class MainMenuScreen extends BaseScreen {

	Image img_bg;
	TextButton btn_play;
	TextButton btn_help;
	TextButton btn_about;
	CreateWindown cr = new CreateWindown();
	
	@Override
	public void show() {
		super.show();
		img_bg = new Image(MainAppleActive.getAtlas().findRegion("datagame/MenuBg"));
		stage.addActor(img_bg);
		
		btn_play = new TextButton("Play", MainAppleActive.getMySkin(),"textButton_50");
		btn_play.setWidth(Constant.STAGE_WIDTH/2);
		btn_play.setX((Constant.STAGE_WIDTH - btn_play.getWidth())/2);
		btn_play.setY(300);
		stage.addActor(btn_play);
		btn_play.addListener(new ClickListener() {
			@Override
			public void touchUp(InputEvent event, float x, float y,
					int pointer, int button) {
				super.touchUp(event, x, y, pointer, button);
				MainAppleActive.getScreenManager().createScreen(ScreenEnum.PLAY_SCREEN);
				MainAppleActive.getScreenManager().getScreen().show();
			}
		});
		
		btn_help = new TextButton("Help", MainAppleActive.getMySkin(),"textButton_50");
		btn_help.setWidth(btn_play.getWidth());
		btn_help.setX(btn_play.getX());
		btn_help.setY(btn_play.getY() - btn_play.getHeight() - 20);
		stage.addActor(btn_help);
		btn_help.addListener(new ClickListener() {
			@Override
			public void touchUp(InputEvent event, float x, float y,
					int pointer, int button) {
				super.touchUp(event, x, y, pointer, button);
				stage.addActor(cr.CreateWindown_Help());
			}
		});
		
		btn_about = new TextButton("About", MainAppleActive.getMySkin(),"textButton_50");
		btn_about.setWidth(btn_play.getWidth());
		btn_about.setX(btn_help.getX());
		btn_about.setY(btn_help.getY() - btn_play.getHeight() - 20);
		stage.addActor(btn_about);
		btn_about.addListener(new ClickListener() {
			@Override
			public void touchUp(InputEvent event, float x, float y,
					int pointer, int button) {
				super.touchUp(event, x, y, pointer, button);
				stage.addActor(cr.CreateWindown_About());
			}
		});
	}

	@Override
	public void hide() {
	}

	@Override
	public void pause() {
	}

	@Override
	public void resume() {
	}

	@Override
	public void dispose() {
	}

}
